import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'providers/restaurant_provider.dart';
import 'screens/main_tab_screen.dart';
import 'providers/product_provider.dart'; // 导入商品Provider
import 'providers/bill_provider.dart'; 
// import 'providers/bill_provider.dart'; // 添加这行
import 'package:flutter_localizations/flutter_localizations.dart';
void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});


  @override
  Widget build(BuildContext context) {
    return MultiProvider(
      providers: [
        ChangeNotifierProvider(create: (_) => RestaurantProvider()),
        ChangeNotifierProvider(create: (_) => ProductProvider()),
        ChangeNotifierProvider(create: (ctx) => BillProvider()), // 添加这行
        // 后续添加其他Provider
      ],
      child: MaterialApp(
        title: '送货对账',
        theme: ThemeData(
          primarySwatch: Colors.blue,
          textTheme: const TextTheme(
            titleLarge: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
            titleMedium: TextStyle(fontSize: 22, fontWeight: FontWeight.bold),
            bodyLarge: TextStyle(fontSize: 20),
            bodyMedium: TextStyle(fontSize: 18),
            bodySmall: TextStyle(fontSize: 16),
          ),
          
          scaffoldBackgroundColor: Colors.grey[50],
        ),

        // 添加中文本地化支持
        localizationsDelegates: const [
          GlobalMaterialLocalizations.delegate,
          GlobalWidgetsLocalizations.delegate,
          GlobalCupertinoLocalizations.delegate,
        ],
          supportedLocales: const [
          Locale('zh', 'CN'), // 中文
        ],
        // home: const BillListScreen(), // 根据实际情况调整
        home: const MainTabScreen(),
        debugShowCheckedModeBanner: false,
      ),
    );
  }
}